#include "com.h"

int main()
{
  key_t key = ftok(PATHNAME, PROJ_ID);
  if(key == -1){
    perror("ftok");
    return 1;
  }

  int shmid = shmget(key, SIZE, IPC_CREAT);
  if(shmid < 0){
    perror("shmget");
    return 1;
  }

  char* shmaddr = shmat(shmid, NULL, 0);

 int i = 0;
 while(1){
   sleep(1);
   shmaddr[i] = 'A' + i;
   i++;
   shmaddr[i] = 0;
 }
  
  shmdt(shmdt);

  return 0;
}
